import { A as __spreadValues, o as on, a as off, aF as getDomNode, aG as addClass, aH as removeClass, p as popup_manager_default, aI as merge, d as defineComponent, e as index$2, j as props, f as setup, aj as ActionSheet, l as $props, $ as $prefix, m as $setup } from "./index.js";
import { J as emitEvent, q as index$3, r as index$4 } from "./index17.js";
import { k as resolveComponent, u as openBlock, y as createBlock, H as withCtx, I as withDirectives, w as createBaseVNode, A as normalizeClass, P as withModifiers, l as createVNode, T as Transition, v as createElementBlock, G as normalizeStyle, D as renderSlot, E as toDisplayString, z as createCommentVNode, L as vShow, a9 as createSlots, N as renderList, O as normalizeProps, ab as guardReactiveProps, F as mergeProps } from "./vue.js";
const computedAnimationName = ({ constants, props: props2 }) => () => props2.rightSlide ? constants.DIALOG_SLIDER_RIGHT : constants.DIALOG_FADE;
const computedAddUnit = (value) => isNaN(Number(value)) ? value : value + "px";
const computedStyle = ({ props: props2, state, designConfig }) => () => {
  var _a;
  let style = {};
  let { width, top, rightSlide, maxHeight } = props2;
  if (top === void 0) {
    top = rightSlide ? "0" : ((_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.top) ? "" : "15vh";
  }
  width = computedAddUnit(width);
  top = computedAddUnit(top);
  maxHeight = computedAddUnit(maxHeight);
  if (!state.isFull) {
    style.width = width;
    style.top = state.top || top;
    style.maxHeight = maxHeight;
    if (rightSlide) {
      style.right = 0;
      style.height = "calc(100vh - " + style.top + ")";
    } else {
      style.left = state.left || "calc((100vw - " + width + ") / 2)";
    }
  }
  if (state.dragStyle) {
    style = __spreadValues(__spreadValues({}, style), state.dragStyle);
    if (state.isFull) {
      style = { left: "0px", top: "0px" };
    }
  }
  return style;
};
const computedBodyStyle = ({ vm, props: props2, state }) => () => {
  const style = {
    maxHeight: ""
  };
  const headerHeight = vm.$refs.header && vm.$refs.header.offsetHeight || 0;
  const footerHeight = vm.$refs.footer && vm.$refs.footer.offsetHeight || 0;
  let { maxHeight } = props2;
  if (state.isFull || props2.rightSlide) {
    if (vm.$slots.footer) {
      style.maxHeight = `calc(100vh - ${headerHeight + footerHeight}px)`;
    } else {
      style.maxHeight = `calc(100vh - ${headerHeight}px)`;
    }
  } else {
    style.maxHeight = "65vh";
  }
  if (maxHeight && !state.isFull) {
    style.maxHeight = "none";
  }
  return style;
};
const watchVisible = ({
  api: api2,
  constants,
  emit,
  nextTick,
  parent,
  props: props2,
  vm,
  state
}) => (val) => {
  const el = parent.$el;
  if (props2.lockScroll) {
    val ? api2.showScrollbar() : api2.hideScrollbar();
  }
  state.move = false;
  state.isFull = props2.fullscreen;
  emit("update:visible", val);
  if (val) {
    state.closed = false;
    emit("open");
    on(el, "scroll", api2.updatePopper);
    nextTick(() => {
      vm.$refs.dialog.scrollTop = 0;
    });
    if (props2.appendToBody) {
      document.body.appendChild(el);
    }
  } else {
    off(el, "scroll", api2.updatePopper);
    if (!state.closed) {
      state.emitter.emit("boxclose", props2.isFormReset);
      emit("close");
    }
    if (props2.destroyOnClose) {
      nextTick(() => state.key++);
    }
    if (props2.rightSlide) {
      const dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el;
      dialogBoxDom.style.left = "";
    }
  }
};
const mounted = ({ api: api2, parent, props: props2 }) => () => {
  if (props2.lockScroll && props2.visible) {
    api2.showScrollbar();
  }
  if (props2.visible) {
    const el = parent.$el;
    api2.open();
    if (props2.appendToBody) {
      document.body.appendChild(el);
    }
  }
};
const unMounted = ({ api: api2, parent, props: props2 }) => () => {
  const el = parent.$el;
  api2.hideScrollbar();
  if (props2.appendToBody && el && el.parentNode) {
    el.parentNode.removeChild(el);
  }
};
const useMouseEventDown = ({ state }) => (event) => {
  state.mouseDownWrapperFlag = false;
  if (/tiny-dialog-box__wrapper/.test(event.target.className) && event.type === "mousedown") {
    state.mouseDownWrapperFlag = true;
  }
};
const useMouseEventUp = ({ state }) => (event) => {
  state.mouseUpWrapperFlag = false;
  if (/tiny-dialog-box__wrapper/.test(event.target.className) && event.type === "mouseup") {
    state.mouseUpWrapperFlag = true;
  }
};
const handleWrapperClick = ({ api: api2, props: props2, state }) => () => {
  if (!props2.closeOnClickModal) {
    return;
  }
  if (state.mouseDownWrapperFlag && state.mouseUpWrapperFlag) {
    api2.handleClose("mask");
  }
};
const handleClose = ({
  api: api2,
  constants,
  emit,
  parent,
  props: props2
}) => (type = "close") => {
  if (typeof props2.beforeClose === "function" && props2.beforeClose(type) === false) {
    return;
  }
  const el = parent.$el;
  if (props2.rightSlide) {
    const dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el;
    dialogBoxDom.style.left = "";
  }
  if (!emitEvent(emit, "before-close", api2.hide)) {
    return;
  }
  api2.hide(type);
};
const hide = ({ api: api2, emit, state, props: props2 }) => (cancel) => {
  if (cancel !== false) {
    state.emitter.emit("boxclose", props2.isFormReset);
    emit("update:visible", false);
    emit("change", false);
    emit("close", cancel);
    state.closed = true;
    api2.hideScrollbar();
  }
};
const handleConfirm = ({ api: api2, emit }) => () => {
  emit("confirm");
  api2.handleClose("confirm");
};
const handleCancel = ({ api: api2, emit }) => () => {
  emit("cancel");
  api2.handleClose("cancel");
};
const updatePopper = ({ api: api2, constants }) => () => {
  api2.broadcast(constants.SELECT_DROPDOWN, "updatePopper");
  api2.broadcast(constants.DROPDOWN_MENU, "updatePopper");
};
const afterEnter = (emit) => () => {
  emit("opened");
};
const afterLeave = (emit) => () => {
  emit("closed");
};
const findPopoverComponent = ({
  vm,
  componentList
}) => {
  const children = vm.$children;
  if (!children || children.length === 0) {
    return [];
  }
  children.forEach((child) => {
    const tag = child.$options.componentName;
    if (tag === "Select") {
      componentList.push(child);
    }
    findPopoverComponent({ vm: child, componentList });
  });
  return componentList;
};
const closeAllPopover = (parent) => {
  findPopoverComponent({ vm: parent, componentList: [] }).forEach((component) => {
    component.state.visible = false;
  });
};
const handleDrag = ({
  parent,
  props: props2,
  state,
  emit,
  vm
}) => (event) => {
  if (!props2.draggable) {
    return;
  }
  let modalBoxElem = vm.$refs.dialog;
  event.preventDefault();
  let demMousemove = document.onmousemove;
  let demMouseup = document.onmouseup;
  let disX = event.clientX - modalBoxElem.offsetLeft;
  let disY = event.clientY - modalBoxElem.offsetTop;
  let { visibleHeight, visibleWidth } = getDomNode();
  document.onmousemove = (event2) => {
    event2.preventDefault();
    if (!state.move) {
      emit("drag-start", event2);
      closeAllPopover(parent);
      state.move = true;
    }
    let offsetWidth = modalBoxElem.offsetWidth;
    let offsetHeight = modalBoxElem.offsetHeight;
    let left;
    let top;
    if (!props2.dragOutsideWindow) {
      let maxX = Math.max(visibleWidth - offsetWidth, 0);
      let maxY = Math.max(visibleHeight - offsetHeight, 0);
      left = event2.clientX - disX;
      top = event2.clientY - disY;
      left = left < 0 ? 0 : left > maxX ? maxX : left;
      top = top < 0 ? 0 : top > maxY ? maxY : top;
    } else {
      let maxX = visibleWidth - 10;
      let maxY = visibleHeight - 10;
      left = event2.clientX - disX;
      top = event2.clientY - disY;
      left = event2.clientX < 0 ? -disX : left > maxX ? maxX : left;
      top = event2.clientY < 0 ? -disY : top > maxY ? maxY : top;
    }
    if (!state.isFull) {
      state.dragStyle = { left: `${left}px`, top: `${top}px` };
    }
    state.left = `${left}px`;
    state.top = `${top}px`;
    state.emitter.emit("boxdrag");
    emit("drag-move", event2);
  };
  document.onmouseup = () => {
    document.onmousemove = demMousemove;
    document.onmouseup = demMouseup;
    state.move = false;
    props2.draggable && emit("drag-end", event);
  };
};
const showScrollbar = (lockScrollClass) => () => {
  addClass(document.body, lockScrollClass);
};
const hideScrollbar = (lockScrollClass) => () => {
  removeClass(document.body, lockScrollClass);
};
const toggleFullScreen = ({ state, emit, nextTick, vm }) => (isFull) => {
  state.isFull = isFull;
  nextTick(() => {
    emit("resize", { fullscreen: isFull, dialog: vm.$refs.dialog });
  });
};
let idSeed = 1;
const isServer = typeof window === "undefined";
const setWatchFn = ({
  onMounted,
  onBeforeUnmount,
  watch,
  vm,
  api: api2,
  props: props2,
  state,
  nextTick
}) => {
  onMounted(() => {
    vm._popupId = `popup-${idSeed++}`;
    popup_manager_default.register(vm._popupId, vm);
  });
  onBeforeUnmount(() => {
    popup_manager_default.deregister(vm._popupId);
    popup_manager_default.closeModal(vm._popupId);
  });
  watch(
    () => props2.visible,
    (val) => {
      if (val) {
        if (vm._opening) {
          return;
        }
        if (state.rendered) {
          api2.open();
        } else {
          state.rendered = true;
          nextTick(() => {
            api2.open();
          });
        }
      } else {
        api2.close();
      }
    }
  );
};
const openFn = ({ state, vm }) => (options) => {
  if (!state.rendered) {
    state.rendered = true;
  }
  const props2 = merge({}, vm.$props || vm, options);
  if (vm._closeTimer) {
    clearTimeout(vm._closeTimer);
    vm._closeTimer = null;
  }
  clearTimeout(vm._openTimer);
  const doOpen = () => {
    if (isServer || state.opened) {
      return;
    }
    vm._opening = true;
    const dom = vm.$el;
    const modal = props2.modal;
    const zIndex = props2.zIndex;
    if (zIndex) {
      popup_manager_default.zIndex = zIndex;
    }
    if (modal) {
      if (vm._closing) {
        popup_manager_default.closeModal(vm._popupId);
        vm._closing = false;
      }
      popup_manager_default.openModal(
        vm._popupId,
        popup_manager_default.nextZIndex(),
        props2.modalAppendToBody ? void 0 : dom,
        props2.modalClass,
        props2.modalFade
      );
      if (props2.lockScroll) {
        popup_manager_default.fixBodyBorder();
        addClass(document.body, popup_manager_default.popLockClass);
      }
    }
    if (getComputedStyle(dom).position === "static") {
      dom.style.position = "absolute";
    }
    dom.style.zIndex = popup_manager_default.nextZIndex().toString();
    state.opened = true;
    vm._opening = false;
  };
  const openDelay = Number(props2.openDelay);
  if (openDelay > 0) {
    vm._openTimer = setTimeout(() => {
      vm._openTimer = null;
      doOpen();
    }, openDelay);
  } else {
    doOpen();
  }
};
const closeFn = ({ state, vm }) => () => {
  if (vm._openTimer !== null) {
    clearTimeout(vm._openTimer);
    vm._openTimer = null;
  }
  clearTimeout(vm._closeTimer);
  const doClose = () => {
    vm._closing = true;
    state.opened = false;
    popup_manager_default.closeModal(vm._popupId);
    vm._closing = false;
  };
  const closeDelay = Number(vm.closeDelay);
  if (closeDelay > 0) {
    vm._closeTimer = setTimeout(() => {
      vm._closeTimer = null;
      doClose();
    }, closeDelay);
  } else {
    doClose();
  }
};
var vue_popup_default = (options) => {
  const { api: api2, nextTick, onBeforeUnmount, onMounted, props: props2, reactive, toRefs, vm, watch } = options;
  const state = reactive({
    opened: false,
    rendered: false
  });
  setWatchFn({ onMounted, onBeforeUnmount, watch, vm, api: api2, props: props2, state, nextTick });
  const open = openFn({ state, vm });
  const close = closeFn({ state, vm });
  return __spreadValues({ open, close, PopupManager: popup_manager_default }, toRefs(state));
};
const api = [
  "afterEnter",
  "afterLeave",
  "handleClose",
  "handleWrapperClick",
  "useMouseEventDown",
  "useMouseEventUp",
  "handleCancel",
  "handleConfirm",
  "handleDrag",
  "toggleFullScreen",
  "state"
];
const initState = ({
  reactive,
  computed,
  api: api2,
  emitter,
  props: props2,
  useBreakpoint
}) => {
  const { current } = useBreakpoint();
  const state = reactive({
    emitter: emitter(),
    key: 0,
    x: null,
    y: null,
    top: null,
    left: null,
    max: null,
    move: false,
    closed: false,
    dragable: false,
    isFull: props2.fullscreen,
    style: computed(() => api2.computedStyle()),
    bodyStyle: computed(() => api2.computedBodyStyle()),
    animationName: computed(() => api2.computedAnimationName()),
    current,
    dragStyle: null
  });
  return state;
};
const mergeState = ({ reactive, state, toRefs, usePopups }) => {
  const { opened, rendered } = usePopups;
  const merge2 = reactive(__spreadValues({
    opened,
    rendered
  }, toRefs(state)));
  return merge2;
};
const initApi = ({
  emit,
  api: api2,
  state,
  parent,
  props: props2,
  lockScrollClass,
  constants,
  usePopups,
  nextTick,
  broadcast,
  designConfig,
  vm
}) => {
  const { open, close } = usePopups;
  Object.assign(api2, {
    state,
    open,
    close,
    broadcast,
    handleCancel: handleCancel({ api: api2, emit }),
    handleConfirm: handleConfirm({ api: api2, emit }),
    updatePopper: updatePopper({ api: api2, constants }),
    handleWrapperClick: handleWrapperClick({ api: api2, props: props2, state }),
    useMouseEventDown: useMouseEventDown({ state }),
    useMouseEventUp: useMouseEventUp({ state }),
    hide: hide({ api: api2, emit, state, props: props2 }),
    handleClose: handleClose({ api: api2, constants, emit, parent, props: props2 }),
    watchVisible: watchVisible({
      api: api2,
      constants,
      emit,
      nextTick,
      parent,
      props: props2,
      vm,
      state
    }),
    computedStyle: computedStyle({ state, props: props2, designConfig }),
    computedBodyStyle: computedBodyStyle({ vm, props: props2, state }),
    mounted: mounted({ api: api2, parent, props: props2 }),
    unMounted: unMounted({ api: api2, parent, props: props2 }),
    computedAnimationName: computedAnimationName({ constants, props: props2 }),
    afterEnter: afterEnter(emit),
    afterLeave: afterLeave(emit),
    hideScrollbar: hideScrollbar(lockScrollClass),
    showScrollbar: showScrollbar(lockScrollClass),
    handleDrag: handleDrag({ parent, props: props2, state, emit, vm }),
    // tiny 新增
    toggleFullScreen: toggleFullScreen({ state, emit, nextTick, vm })
  });
};
const initWatch = ({ watch, state, api: api2, props: props2 }) => {
  watch(() => props2.visible, api2.watchVisible);
  watch(
    () => props2.fullscreen,
    (value) => {
      state.isFull = value;
    }
  );
};
const renderless = (props2, { computed, onBeforeUnmount, onMounted, toRefs, reactive, watch }, {
  vm,
  emitter,
  parent,
  emit,
  constants,
  nextTick,
  mode,
  broadcast,
  designConfig,
  useBreakpoint
}) => {
  const api2 = {};
  const lockScrollClass = constants.scrollLockClass(mode);
  let state = initState({ reactive, computed, api: api2, emitter, props: props2, useBreakpoint });
  const usePopups = vue_popup_default({
    api: api2,
    nextTick,
    onBeforeUnmount,
    onMounted,
    props: props2,
    reactive,
    toRefs,
    vm,
    watch
  });
  initApi({
    api: api2,
    state,
    parent,
    props: props2,
    emit,
    constants,
    usePopups,
    lockScrollClass,
    nextTick,
    vm,
    broadcast,
    designConfig
  });
  state = mergeState({ reactive, state, toRefs, usePopups });
  initWatch({ watch, state, api: api2, props: props2 });
  onMounted(api2.mounted);
  onBeforeUnmount(api2.unMounted);
  return api2;
};
const index$1 = "";
function _createForOfIteratorHelperLoose$2(o, allowArrayLike) {
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  if (it)
    return (it = it.call(o)).next.bind(it);
  if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") {
    if (it)
      o = it;
    var i = 0;
    return function() {
      if (i >= o.length)
        return { done: true };
      return { done: false, value: o[i++] };
    };
  }
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray$2(o, minLen) {
  if (!o)
    return;
  if (typeof o === "string")
    return _arrayLikeToArray$2(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor)
    n = o.constructor.name;
  if (n === "Map" || n === "Set")
    return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
    return _arrayLikeToArray$2(o, minLen);
}
function _arrayLikeToArray$2(arr, len) {
  if (len == null || len > arr.length)
    len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++)
    arr2[i] = arr[i];
  return arr2;
}
var _export_sfc$2 = function _export_sfc2(sfc, props2) {
  var target = sfc.__vccOpts || sfc;
  for (var _iterator = _createForOfIteratorHelperLoose$2(props2), _step; !(_step = _iterator()).done; ) {
    var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
    target[key] = val;
  }
  return target;
};
var _sfc_main$2 = defineComponent({
  components: {
    IconClose: index$2(),
    IconFullscreen: index$3(),
    IconMinscreen: index$4()
  },
  emits: [
    "update:visible",
    "change",
    "before-close",
    "open",
    "close",
    "opened",
    "confirm",
    "cancel",
    "closed",
    "drag-start",
    "drag-move",
    "drag-end",
    // tiny 新增
    "resize"
  ],
  props: [].concat(props, ["resize", "isFormReset", "visible", "title", "modal", "modalAppendToBody", "appendToBody", "lockScroll", "closeOnClickModal", "closeOnPressEscape", "showClose", "width", "fullscreen", "top", "center", "draggable", "dragOutsideWindow", "showHeader", "rightSlide", "destroyOnClose", "dialogClass", "beforeClose", "maxHeight", "dialogTransition"]),
  model: {
    prop: "visible",
    event: "update:visible"
  },
  provide: function provide() {
    return {
      dialog: this
    };
  },
  setup: function setup$1(props2, context) {
    return setup({
      props: props2,
      context,
      renderless,
      api
    });
  }
});
var _hoisted_1$2 = {
  class: "tiny-dialog-box__title"
};
var _hoisted_2$2 = {
  key: 1,
  class: "tiny-dialog-box__footer"
};
function _sfc_render$2(_ctx, _cache, $props2, $setup2, $data, $options) {
  var _component_icon_fullscreen = resolveComponent("icon-fullscreen");
  var _component_icon_minscreen = resolveComponent("icon-minscreen");
  var _component_icon_close = resolveComponent("icon-close");
  return openBlock(), createBlock(Transition, {
    name: _ctx.state.animationName,
    onAfterEnter: _ctx.afterEnter,
    onAfterLeave: _ctx.afterLeave,
    persisted: ""
  }, {
    default: withCtx(function() {
      return [withDirectives(createBaseVNode(
        "div",
        {
          class: normalizeClass(["tiny-dialog-box__wrapper", _ctx.dialogClass]),
          onClick: _cache[5] || (_cache[5] = withModifiers(function() {
            return _ctx.handleWrapperClick && _ctx.handleWrapperClick.apply(_ctx, arguments);
          }, ["self"])),
          onMouseup: _cache[6] || (_cache[6] = function() {
            return _ctx.useMouseEventUp && _ctx.useMouseEventUp.apply(_ctx, arguments);
          }),
          onMousedown: _cache[7] || (_cache[7] = function() {
            return _ctx.useMouseEventDown && _ctx.useMouseEventDown.apply(_ctx, arguments);
          })
        },
        [createVNode(Transition, {
          name: _ctx.dialogTransition
        }, {
          default: withCtx(function() {
            return [(_ctx.destroyOnClose ? _ctx.visible : true) ? withDirectives((openBlock(), createElementBlock(
              "div",
              {
                ref: "dialog",
                class: normalizeClass([[{
                  "is-fullscreen": _ctx.state.isFull,
                  "is-center": _ctx.center,
                  "is-right-slide": _ctx.rightSlide
                }], "tiny-dialog-box"]),
                style: normalizeStyle(_ctx.state.style),
                key: _ctx.state.key
              },
              [_ctx.showHeader ? (openBlock(), createElementBlock(
                "div",
                {
                  key: 0,
                  class: "tiny-dialog-box__header",
                  onMousedown: _cache[4] || (_cache[4] = function() {
                    return _ctx.handleDrag && _ctx.handleDrag.apply(_ctx, arguments);
                  })
                },
                [renderSlot(_ctx.$slots, "title", {}, function() {
                  return [createBaseVNode(
                    "span",
                    _hoisted_1$2,
                    toDisplayString(_ctx.title),
                    1
                    /* TEXT */
                  )];
                }), _ctx.resize && !_ctx.state.isFull ? (openBlock(), createElementBlock("button", {
                  key: 0,
                  type: "button",
                  class: "tiny-dialog-box__headerbtn",
                  "aria-label": "Resize",
                  onClick: _cache[0] || (_cache[0] = function($event) {
                    return _ctx.toggleFullScreen(true);
                  })
                }, [createVNode(_component_icon_fullscreen, {
                  class: "tiny-svg-size tiny-dialog-box__close"
                })])) : createCommentVNode("v-if", true), _ctx.resize && _ctx.state.isFull ? (openBlock(), createElementBlock("button", {
                  key: 1,
                  type: "button",
                  class: "tiny-dialog-box__headerbtn",
                  "aria-label": "Resize",
                  onClick: _cache[1] || (_cache[1] = function($event) {
                    return _ctx.toggleFullScreen(false);
                  })
                }, [createVNode(_component_icon_minscreen, {
                  class: "tiny-svg-size tiny-dialog-box__close"
                })])) : createCommentVNode("v-if", true), _ctx.showClose ? (openBlock(), createElementBlock(
                  "button",
                  {
                    key: 2,
                    type: "button",
                    class: "tiny-dialog-box__headerbtn",
                    "aria-label": "Close",
                    onClick: _cache[2] || (_cache[2] = function($event) {
                      return _ctx.handleClose("close", $event);
                    }),
                    onMousedown: _cache[3] || (_cache[3] = withModifiers(function() {
                    }, ["stop"]))
                  },
                  [createVNode(_component_icon_close, {
                    class: "tiny-svg-size tiny-dialog-box__close"
                  })],
                  32
                  /* NEED_HYDRATION */
                )) : createCommentVNode("v-if", true)],
                32
                /* NEED_HYDRATION */
              )) : createCommentVNode("v-if", true), createBaseVNode(
                "div",
                {
                  class: "tiny-dialog-box__body",
                  style: normalizeStyle(_ctx.state.bodyStyle)
                },
                [renderSlot(_ctx.$slots, "default")],
                4
                /* STYLE */
              ), _ctx.slots.footer ? (openBlock(), createElementBlock("div", _hoisted_2$2, [renderSlot(_ctx.$slots, "footer", {
                beforeClose: _ctx.beforeClose
              })])) : createCommentVNode("v-if", true)],
              6
              /* CLASS, STYLE */
            )), [[vShow, _ctx.visible]]) : createCommentVNode("v-if", true)];
          }),
          _: 3
          /* FORWARDED */
        }, 8, ["name"])],
        34
        /* CLASS, NEED_HYDRATION */
      ), [[vShow, _ctx.visible]])];
    }),
    _: 3
    /* FORWARDED */
  }, 8, ["name", "onAfterEnter", "onAfterLeave"]);
}
var pc = /* @__PURE__ */ _export_sfc$2(_sfc_main$2, [["render", _sfc_render$2]]);
const index = "";
function _createForOfIteratorHelperLoose$1(o, allowArrayLike) {
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  if (it)
    return (it = it.call(o)).next.bind(it);
  if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") {
    if (it)
      o = it;
    var i = 0;
    return function() {
      if (i >= o.length)
        return { done: true };
      return { done: false, value: o[i++] };
    };
  }
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray$1(o, minLen) {
  if (!o)
    return;
  if (typeof o === "string")
    return _arrayLikeToArray$1(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor)
    n = o.constructor.name;
  if (n === "Map" || n === "Set")
    return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
    return _arrayLikeToArray$1(o, minLen);
}
function _arrayLikeToArray$1(arr, len) {
  if (len == null || len > arr.length)
    len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++)
    arr2[i] = arr[i];
  return arr2;
}
var _export_sfc$1 = function _export_sfc22(sfc, props2) {
  var target = sfc.__vccOpts || sfc;
  for (var _iterator = _createForOfIteratorHelperLoose$1(props2), _step; !(_step = _iterator()).done; ) {
    var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
    target[key] = val;
  }
  return target;
};
var _sfc_main$1 = defineComponent({
  emits: ["update:visible", "change", "before-close", "open", "close", "opened", "confirm", "cancel", "closed"],
  props: [].concat(props, ["visible", "title", "modal", "closeOnClickModal", "modalAppendToBody", "appendToBody", "width", "top", "showHeader", "destroyOnClose"]),
  model: {
    prop: "visible",
    event: "update:visible"
  },
  setup: function setup$12(props2, context) {
    return setup({
      props: props2,
      context,
      renderless,
      api
    });
  }
});
var _hoisted_1$1 = {
  key: 0,
  class: "tiny-mobile-dialog-box__header"
};
var _hoisted_2$1 = {
  class: "tiny-mobile-dialog-box__title"
};
var _hoisted_3$1 = {
  class: "tiny-mobile-dialog-box__body"
};
var _hoisted_4$1 = {
  class: "tiny-mobile-dialog-box__footer"
};
function _sfc_render$1(_ctx, _cache, $props2, $setup2, $data, $options) {
  return openBlock(), createBlock(Transition, {
    name: "dialog-fade",
    persisted: ""
  }, {
    default: withCtx(function() {
      return [withDirectives(createBaseVNode(
        "div",
        {
          class: "tiny-mobile-dialog-box__wrapper",
          onClick: _cache[2] || (_cache[2] = withModifiers(function() {
            return _ctx.handleWrapperClick && _ctx.handleWrapperClick.apply(_ctx, arguments);
          }, ["self"]))
        },
        [(openBlock(), createElementBlock(
          "div",
          {
            ref: "dialog",
            class: normalizeClass([{
              "is-hide-header": !_ctx.showHeader
            }, "tiny-mobile-dialog-box"]),
            key: _ctx.state.key
          },
          [_ctx.showHeader ? (openBlock(), createElementBlock("div", _hoisted_1$1, [renderSlot(_ctx.$slots, "title", {}, function() {
            return [createBaseVNode(
              "span",
              _hoisted_2$1,
              toDisplayString(_ctx.title),
              1
              /* TEXT */
            )];
          })])) : createCommentVNode("v-if", true), createBaseVNode("div", _hoisted_3$1, [renderSlot(_ctx.$slots, "default")]), createBaseVNode("div", _hoisted_4$1, [renderSlot(_ctx.$slots, "footer", {}, function() {
            return [createBaseVNode(
              "button",
              {
                type: "button",
                onClick: _cache[0] || (_cache[0] = function() {
                  return _ctx.handleCancel && _ctx.handleCancel.apply(_ctx, arguments);
                }),
                class: "tiny-mobile-dialog-box__button cancel-button"
              },
              toDisplayString(_ctx.t("ui.dialogBox.cancel")),
              1
              /* TEXT */
            ), createBaseVNode(
              "button",
              {
                type: "button",
                onClick: _cache[1] || (_cache[1] = function() {
                  return _ctx.handleConfirm && _ctx.handleConfirm.apply(_ctx, arguments);
                }),
                class: "tiny-mobile-dialog-box__button confirm-button"
              },
              toDisplayString(_ctx.t("ui.dialogBox.confirm")),
              1
              /* TEXT */
            )];
          })])],
          2
          /* CLASS */
        ))],
        512
        /* NEED_PATCH */
      ), [[vShow, _ctx.visible]])];
    }),
    _: 3
    /* FORWARDED */
  });
}
var mobile = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["render", _sfc_render$1]]);
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  if (it)
    return (it = it.call(o)).next.bind(it);
  if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
    if (it)
      o = it;
    var i = 0;
    return function() {
      if (i >= o.length)
        return { done: true };
      return { done: false, value: o[i++] };
    };
  }
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
  if (!o)
    return;
  if (typeof o === "string")
    return _arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor)
    n = o.constructor.name;
  if (n === "Map" || n === "Set")
    return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
    return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length)
    len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++)
    arr2[i] = arr[i];
  return arr2;
}
var _export_sfc = function _export_sfc23(sfc, props2) {
  var target = sfc.__vccOpts || sfc;
  for (var _iterator = _createForOfIteratorHelperLoose(props2), _step; !(_step = _iterator()).done; ) {
    var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
    target[key] = val;
  }
  return target;
};
var _sfc_main = defineComponent({
  components: {
    IconClose: index$2(),
    IconFullscreen: index$3(),
    IconMinscreen: index$4(),
    TinyActionSheet: ActionSheet
  },
  emits: ["update:visible", "change", "before-close", "open", "close", "opened", "confirm", "cancel", "closed", "drag-start", "drag-move", "drag-end"],
  props: [].concat(props, ["resize", "isFormReset", "visible", "title", "modal", "modalAppendToBody", "appendToBody", "lockScroll", "closeOnClickModal", "closeOnPressEscape", "showClose", "width", "fullscreen", "top", "center", "draggable", "showHeader", "rightSlide", "destroyOnClose", "dialogClass", "beforeClose", "maxHeight"]),
  model: {
    prop: "visible",
    event: "update:visible"
  },
  setup: function setup$13(props2, context) {
    return setup({
      props: props2,
      context,
      renderless,
      api
    });
  }
});
var _hoisted_1 = {
  key: 0
};
var _hoisted_2 = {
  "data-tag": "tiny-dialog-box__title",
  class: "text-sm text-color-text-primary mr-4 flex-1 font-bold"
};
var _hoisted_3 = {
  key: 1,
  "data-tag": "tiny-dialog-box__footer",
  class: "pt-4 pr-6 pb-4 pl-6 text-right box-border border-t border-t-color-bg-3 [&_[data-tag=tiny-button]]:mx-1 [&_[data-tag=tiny-button]]:my-0 [&_[data-tag=tiny-toolbar]_[data-tag=tiny-button]]:my-0 [&_[data-tag=tiny-toolbar]_[data-tag=tiny-button]]:mx-1"
};
var _hoisted_4 = {
  key: 1
};
function _sfc_render(_ctx, _cache, $props2, $setup2, $data, $options) {
  var _component_icon_fullscreen = resolveComponent("icon-fullscreen");
  var _component_icon_minscreen = resolveComponent("icon-minscreen");
  var _component_icon_close = resolveComponent("icon-close");
  var _component_tiny_action_sheet = resolveComponent("tiny-action-sheet");
  return openBlock(), createElementBlock("div", null, [_ctx.state.current !== "default" ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(Transition, {
    name: _ctx.state.animationName,
    onAfterEnter: _ctx.afterEnter,
    onAfterLeave: _ctx.afterLeave,
    persisted: ""
  }, {
    default: withCtx(function() {
      return [withDirectives(createBaseVNode(
        "div",
        {
          class: normalizeClass(["fixed inset-0 m-0 flex items-center", _ctx.dialogClass]),
          "data-tag": "tiny-dialog-box__wrapper",
          onClick: _cache[4] || (_cache[4] = withModifiers(function() {
            return _ctx.handleWrapperClick && _ctx.handleWrapperClick.apply(_ctx, arguments);
          }, ["self"]))
        },
        [(_ctx.destroyOnClose ? _ctx.visible : true) ? (openBlock(), createElementBlock(
          "div",
          {
            ref: "dialog",
            "data-tag": "tiny-dialog-box",
            class: normalizeClass([[{
              "left-0 top-0 w-screen h-screen": _ctx.state.isFull,
              "text-center": _ctx.center,
              "flex flex-col rounded-none": _ctx.rightSlide
            }], "absolute bg-color-bg-1 border-none overflow-hidden shadow-xl rounded flex flex-col"]),
            style: normalizeStyle(_ctx.state.style),
            key: _ctx.state.key
          },
          [_ctx.showHeader ? (openBlock(), createElementBlock(
            "div",
            {
              key: 0,
              "data-tag": "tiny-dialog-box__header",
              class: "px-6 py-4 h-12 leading-4 bg-color-bg-1 flex justify-between items-center border-b border-b-color-bg-3",
              onMousedown: _cache[3] || (_cache[3] = function() {
                return _ctx.handleDrag && _ctx.handleDrag.apply(_ctx, arguments);
              })
            },
            [renderSlot(_ctx.$slots, "title", {}, function() {
              return [createBaseVNode(
                "span",
                _hoisted_2,
                toDisplayString(_ctx.title),
                1
                /* TEXT */
              )];
            }), _ctx.resize && !_ctx.state.isFull ? (openBlock(), createElementBlock("button", {
              key: 0,
              type: "button",
              "data-tag": "tiny-dialog-box__headerbtn",
              class: "border-none p-0 leading-none cursor-pointer focus:outline-0",
              "aria-label": "Resize",
              onClick: _cache[0] || (_cache[0] = function($event) {
                return _ctx.toggleFullScreen(true);
              })
            }, [createVNode(_component_icon_fullscreen, {
              "data-tag": "tiny-svg-size tiny-dialog-box__close",
              class: "fill-color-text-primary text-base hover:fill-color-brand"
            })])) : createCommentVNode("v-if", true), _ctx.resize && _ctx.state.isFull ? (openBlock(), createElementBlock("button", {
              key: 1,
              type: "button",
              "data-tag": "tiny-dialog-box__headerbtn",
              class: "border-none p-0 leading-none cursor-pointer focus:outline-0",
              "aria-label": "Resize",
              onClick: _cache[1] || (_cache[1] = function($event) {
                return _ctx.toggleFullScreen(false);
              })
            }, [createVNode(_component_icon_minscreen, {
              "data-tag": "tiny-svg-size tiny-dialog-box__close",
              class: "fill-color-text-primary text-base hover:fill-color-brand"
            })])) : createCommentVNode("v-if", true), _ctx.showClose ? (openBlock(), createElementBlock("button", {
              key: 2,
              type: "button",
              "data-tag": "tiny-dialog-box__headerbtn",
              class: "border-none p-0 leading-none cursor-pointer focus:outline-0",
              "aria-label": "Close",
              onClick: _cache[2] || (_cache[2] = function($event) {
                return _ctx.handleClose("close", $event);
              })
            }, [createVNode(_component_icon_close, {
              "data-tag": "tiny-svg-size tiny-dialog-box__close",
              class: "fill-color-text-primary text-base hover:fill-color-brand"
            })])) : createCommentVNode("v-if", true)],
            32
            /* NEED_HYDRATION */
          )) : createCommentVNode("v-if", true), createBaseVNode(
            "div",
            {
              "data-tag": "tiny-dialog-box__body",
              class: normalizeClass(["text-left pt-0 pr-6 pb-0 pl-6 mb-3 mt-3 text-color-text-primary leading-5.5 text-sm overflow-auto", [_ctx.state.isFull ? "max-h-[calc(100vh-theme(spacing.28))]" : "max-h-[65vh]", _ctx.rightSlide ? "max-h-[none] flex-auto" : ""]]),
              style: normalizeStyle(_ctx.state.bodyStyle)
            },
            [renderSlot(_ctx.$slots, "default")],
            6
            /* CLASS, STYLE */
          ), _ctx.slots.footer ? (openBlock(), createElementBlock("div", _hoisted_3, [renderSlot(_ctx.$slots, "footer", {
            beforeClose: _ctx.beforeClose
          })])) : createCommentVNode("v-if", true)],
          6
          /* CLASS, STYLE */
        )) : createCommentVNode("v-if", true)],
        2
        /* CLASS */
      ), [[vShow, _ctx.visible]])];
    }),
    _: 3
    /* FORWARDED */
  }, 8, ["name", "onAfterEnter", "onAfterLeave"])])) : createCommentVNode("v-if", true), _ctx.state.current === "default" ? (openBlock(), createElementBlock("div", _hoisted_4, [(_ctx.destroyOnClose ? _ctx.visible : true) ? (openBlock(), createBlock(_component_tiny_action_sheet, mergeProps({
    key: 0,
    ref: "dialog"
  }, _ctx.$props, {
    "show-footer": true,
    mask: _ctx.modal,
    "mask-closable": _ctx.closeOnClickModal,
    "before-close": _ctx.beforeClose,
    "onUpdate:visible": _cache[5] || (_cache[5] = function($event) {
      return _ctx.$emit("update:visible", $event);
    })
  }), createSlots({
    _: 2
    /* DYNAMIC */
  }, [renderList(_ctx.slots, function(value, name) {
    return {
      name,
      fn: withCtx(function(scopeData) {
        return [createBaseVNode(
          "div",
          {
            class: normalizeClass({
              "flex w-full justify-between px-4 [&_[data-tag=tiny-button]]:flex-grow [&_[data-tag=tiny-button]:nth-child(2)]:ml-2": name === "footer",
              "px-4 min-h-[250px]": name === "default"
            })
          },
          [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(scopeData)))],
          2
          /* CLASS */
        )];
      })
    };
  })]), 1040, ["mask", "mask-closable", "before-close"])) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true)]);
}
var mobileFirst = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
function _extends() {
  _extends = Object.assign ? Object.assign.bind() : function(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
    return target;
  };
  return _extends.apply(this, arguments);
}
var template = function template2(mode) {
  var _process$env;
  var tinyMode = typeof process === "object" ? (_process$env = {}) == null ? void 0 : _process$env.TINY_MODE : null;
  if ("pc" === (tinyMode || mode)) {
    return pc;
  }
  if ("mobile" === (tinyMode || mode)) {
    return mobile;
  }
  if ("mobile-first" === (tinyMode || mode)) {
    return mobileFirst;
  }
  return pc;
};
var $constants = {
  DIALOG_SLIDER_RIGHT: "dialog-slideRight",
  DIALOG_FADE: "dialog-fade",
  SELECT_DROPDOWN: $prefix + "SelectDropdown",
  DROPDOWN_MENU: $prefix + "DropdownMenu",
  DIALOG_BOX_CLASS: "div.tiny-dialog-box",
  PC_SCROLL_LOCK_CLASS: "dialog-box__scroll-lock",
  MOBILE_SCROLL_LOCK_CLASS: "mobile-dialog-box__scroll-lock",
  Mode: "pc",
  scrollLockClass: function scrollLockClass(mode) {
    return mode === this.Mode ? this.PC_SCROLL_LOCK_CLASS : this.MOBILE_SCROLL_LOCK_CLASS;
  }
};
var dialogBoxProps = _extends({}, $props, {
  _constants: {
    type: Object,
    default: function _default() {
      return $constants;
    }
  },
  appendToBody: {
    type: Boolean,
    default: function _default2() {
      return false;
    }
  },
  beforeClose: Function,
  center: {
    type: Boolean,
    default: function _default3() {
      return false;
    }
  },
  closeOnClickModal: {
    type: Boolean,
    default: function _default4() {
      return true;
    }
  },
  closeOnPressEscape: {
    type: Boolean,
    default: function _default5() {
      return true;
    }
  },
  destroyOnClose: {
    type: Boolean,
    default: function _default6() {
      return false;
    }
  },
  dialogClass: {
    type: String,
    default: function _default7() {
      return "";
    }
  },
  draggable: {
    type: Boolean,
    default: function _default8() {
      return false;
    }
  },
  dragOutsideWindow: {
    type: Boolean,
    default: function _default9() {
      return false;
    }
  },
  fullscreen: {
    type: Boolean,
    default: function _default10() {
      return false;
    }
  },
  isFormReset: {
    type: Boolean,
    default: function _default11() {
      return true;
    }
  },
  lockScroll: {
    type: Boolean,
    default: function _default12() {
      return true;
    }
  },
  modal: {
    type: Boolean,
    default: function _default13() {
      return true;
    }
  },
  modalAppendToBody: {
    type: Boolean,
    default: function _default14() {
      return true;
    }
  },
  resize: {
    type: Boolean,
    default: function _default15() {
      return false;
    }
  },
  rightSlide: {
    type: Boolean,
    default: function _default16() {
      return false;
    }
  },
  showClose: {
    type: Boolean,
    default: function _default17() {
      return true;
    }
  },
  showHeader: {
    type: Boolean,
    default: function _default18() {
      return true;
    }
  },
  title: {
    type: String,
    default: function _default19() {
      return "";
    }
  },
  top: String,
  visible: {
    type: Boolean,
    default: function _default20() {
      return false;
    }
  },
  width: {
    type: String,
    default: function _default21() {
      return "500px";
    }
  },
  maxHeight: {
    type: String,
    default: function _default22() {
      return "";
    }
  },
  dialogTransition: {
    type: String,
    default: ""
  }
});
var DialogBox = defineComponent({
  name: $prefix + "DialogBox",
  model: {
    prop: "visible",
    event: "update:visible"
  },
  props: dialogBoxProps,
  setup: function setup2(props2, context) {
    return $setup({
      props: props2,
      context,
      template
    });
  }
});
var version = "3.16.0";
DialogBox.install = function(Vue) {
  Vue.component(DialogBox.name, DialogBox);
};
DialogBox.version = version;
export {
  DialogBox as D
};
